<div class="container">
<style>
body{
	overflow-x:hidden;
}
</style>
<h2><span class="title">发布商品</span></h2>

<form accept-charset="utf-8"  role="form"  class="form-horizontal" method="post" id="ProductAddForm" action="{{$this->Html->url('/products/add.html')}}">
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ProductName">商品名称</label>
		<div class="col-sm-9 controls">
			<input type="text"  class="form-control" id="ProductName" maxlength="250" name="data[Product][name]">
		</div>
	</div>
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ProductPublished">是否上架</label>
		<div class="col-sm-9 controls select">
			<select id="ProductPublished" class="form-control" name="data[Product][published]">
				<option value="0">否</option>
				<option value="1">是</option>
			</select>
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ProductPublished">封面图片</label>
		<div class="col-sm-9 controls select">
			{{$this->Swfupload->load('coverimg',array('modelClass'=>'Product','label'=>false,'isadmin'=>false))}}
		</div>
	</div>
	
	
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ProductPrice">价格</label>
		<div class="col-sm-9 controls number">
			<input type="number" id="ProductPrice" step="any" class="form-control" name="data[Product][price]">
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ProductName">商品描述</label>
		<div class="col-sm-9">
			<textarea id="ProductContent"  class="form-control" cols="30" rows="4" name="data[Product][content]"></textarea>
		</div>
	</div>
	
	<div class="form-group">
		<label class="col-sm-2 control-label" for="ProductName"></label>
		<div class="col-sm-9"><input class="btn btn-primary" type="submit" value="提交"></div>
	</div>
</form>

{{$this->Html->script(array(
	'ckeditor/ckeditor.js',
	'swfupload/swfupload.js',
	'swfupload/swfupload.queue.js',
	'swfupload/swfupload.cookies.js',
	'swfupload/fileprogress.js',
	'swfupload/handlers.js',
))}}

<script>
$(function(){
	CKEDITOR.editorConfig = function( config ){
		config.toolbar = 'FRONT';
	}
	ckeditors['ProductContent'] = CKEDITOR.replace( 'ProductContent',
		    {
		        customConfig : '{{$this->Html->url("/js/ckeditor/front-config.js")}}'
		    });
	ckeditors['ProductContent'].on('focus',function(e){
		current_ckeditor_instance = e.editor;
	});
	

	CKEDITOR.on( 'instanceReady', function( e ){
		e.editor.document.appendStyleSheet( '{{$this->Html->url("/stylevars/getcss.css")}}' );
		e.editor.document.appendStyleSheet( '{{$this->Html->url("/css/ui-customer.css")}}' );
		//e.editor.setMode( 'source' );
		e.editor.on( 'mode', function( e ){
			if(e.editor.mode == 'wysiwyg'){
				e.editor.document.appendStyleSheet( '{{$this->Html->url("/stylevars/getcss.css")}}' );
				e.editor.document.appendStyleSheet( '{{$this->Html->url("/css/ui-customer.css")}}' );
			}
		});
		//if($('.cke_top').parent('ui-dialog-content').size()<1){
		//	$('.cke_top').addClass('clearfix').affix();
		//}
	});
})
</script>
</div>